package com.kakarote.examine.constant;

import com.kakarote.core.common.enums.SystemCodeEnum;
import com.kakarote.core.exception.CrmException;

import java.util.Objects;

//审批被拒后重新提交类型1：跳过审批流已通过的层级，返回拒绝的层级2：返回审批流初始层级
public enum RejectHandleTypeEnum {

    //返回拒绝的层级
    RETURN_REJECT_LEVEL(1),
    //返回审批流初始层级
    RETURN_FIRST_NODE(2);

    private RejectHandleTypeEnum(Integer type) {
        this.type = type;
    }

    private Integer type;

    public Integer getType() {
        return type;
    }

    public static RejectHandleTypeEnum valueOf(Integer type) {
        for (RejectHandleTypeEnum rejectHandleTypeEnum : values()) {
            if (Objects.equals(type, rejectHandleTypeEnum.getType())) {
                return rejectHandleTypeEnum;
            }
        }
        throw new CrmException(SystemCodeEnum.SYSTEM_NO_VALID);
    }
}
